using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace EIMS.Models
{
    /// <summary>
    /// 供应商联系人实体类
    /// </summary>
    public class SupplierContact
    {
        public int Id { get; set; }

        [Required(ErrorMessage = "联系人姓名不能为空")]
        [Display(Name = "联系人姓名")]
        [StringLength(50, ErrorMessage = "联系人姓名不能超过50个字符")]
        public string Name { get; set; }

        [Display(Name = "职位")]
        [StringLength(50, ErrorMessage = "职位不能超过50个字符")]
        public string Position { get; set; }

        [Display(Name = "部门")]
        [StringLength(50, ErrorMessage = "部门不能超过50个字符")]
        public string Department { get; set; }

        [Display(Name = "手机号码")]
        [StringLength(20, ErrorMessage = "手机号码不能超过20个字符")]
        [RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "请输入有效的手机号码")]
        public string Mobile { get; set; }

        [Display(Name = "电话号码")]
        [StringLength(20, ErrorMessage = "电话号码不能超过20个字符")]
        [RegularExpression(@"^0\d{2,3}-\d{7,8}$", ErrorMessage = "请输入有效的电话号码")]
        public string PhoneNumber { get; set; }

        [Display(Name = "电子邮箱")]
        [EmailAddress(ErrorMessage = "请输入有效的电子邮箱地址")]
        [StringLength(100, ErrorMessage = "电子邮箱不能超过100个字符")]
        public string Email { get; set; }

        [Display(Name = "QQ/微信")]
        [StringLength(50, ErrorMessage = "QQ/微信不能超过50个字符")]
        public string SocialMedia { get; set; }

        [Display(Name = "是否主要联系人")]
        public bool IsPrimary { get; set; }

        [Display(Name = "默认联系人")]
        public bool IsDefault { get; set; }

        [Display(Name = "备注")]
        [StringLength(500, ErrorMessage = "备注不能超过500个字符")]
        public string Remarks { get; set; }

        [Display(Name = "创建时间")]
        public DateTime CreatedAt { get; set; }

        [Display(Name = "更新时间")]
        public DateTime? UpdatedAt { get; set; }

        // 外键关联
        [Display(Name = "所属供应商")]
        [Required(ErrorMessage = "所属供应商不能为空")]
        public int SupplierId { get; set; }

        [ForeignKey("SupplierId")]
        public Supplier Supplier { get; set; }
    }
} 